package pe.com.hermes.hermetic.negocio.ultil;

import pe.com.hermes.hermetic.beans.AbonoBean;

import java.util.Comparator;

public class MontoComparator implements Comparator {
    
    public MontoComparator() {
    }
    
    public int compare(Object o1, Object o2) {
      AbonoBean abon1Bean = (AbonoBean) o1;
      AbonoBean abon2Bean = (AbonoBean) o2;
      
      if (abon1Bean.getNeto()==null || abon1Bean.getNeto().trim().equals("")){
          abon1Bean.setNeto("0");
      }
      if (abon2Bean.getNeto()==null || abon2Bean.getNeto().trim().equals("")){
          abon2Bean.setNeto("0");
      }
      
      Double dObj1 = new Double(abon1Bean.getNeto());    
      Double dObj2 = new Double(abon2Bean.getNeto());
      
      int dif = dObj1.compareTo(dObj2);       
      
      return dif;
    }

    public boolean equals(Object o) {
      return this == o;
    }
    
}
